package com.liuyang.homework.SQL;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by liuyang on 2017/1/14.
 */

public class NewsBaseHelper extends SQLiteOpenHelper {

    private static final int VERSION = 1;
    private static final String DATEBASE_NAME="newsBase.db";

    public NewsBaseHelper(Context context) {
        super(context, DATEBASE_NAME, null, VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table " + NewsDbSchema.NewsTable.NAME+"("+
        "_id integer primary key autoincrement,"+
                NewsDbSchema.NewsTable.Cols.UUID+","+
                NewsDbSchema.NewsTable.Cols.TITLE+","+
                NewsDbSchema.NewsTable.Cols.CONTENT+","+
                NewsDbSchema.NewsTable.Cols.ISKEY+","+
                NewsDbSchema.NewsTable.Cols.KEYWORDS+","+
                NewsDbSchema.NewsTable.Cols.CREATEDAT+","+
                NewsDbSchema.NewsTable.Cols.URL+","+
                NewsDbSchema.NewsTable.Cols.SOURCE+","+
                NewsDbSchema.NewsTable.Cols.IMAGE+
                ")");

    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
